<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNoticesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('notices', function (Blueprint $table) {
            $table->id();
            $table->integer('store_id')->unsigned()->default(0)->comment('店铺id');
            $table->string('title', 100)->default('')->comment('公告名称');
            $table->string('cover', 100)->default('')->comment('公告封面');
            $table->text('detail')->comment('公告详情');
            $table->tinyInteger('status')->default(1)->comment('公告状态，1启用，0禁用');
            $table->datetime('begin_at')->nullable()->comment('开始时间');
            $table->datetime('end_at')->nullable()->comment('结束时间');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `notices` comment '公告表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('notices');
    }
}
